﻿var oldgridSelectedColor='#ffffff';
function setMouseOverColor(element) {
    
    try {
        oldgridSelectedColor = element.style.backgroundColor;
        element.style.backgroundColor = '#BBCEEA';
    }
    catch (e)
    { }

    // element.style.cursor='hand';
    // element.style.textDecoration='underline';
}
function setMouseOutColor(element) {
    
    try {
        element.style.backgroundColor = oldgridSelectedColor;
        element.style.textDecoration = 'none';
    }
    catch (e)
    { }

}
//function killErrors() {
//return true;
//}
//window.onerror = killErrors;


// 判断日期格式符合YYYY-MM-DD格式 
function IsDate(str) {
    var re = /^\d{4}-\d{1,2}-\d{1,2}$/;
    if (re.test(str)) {
        // 开始日期的逻辑判断，是否为合法的日期 
        var array = str.split('-');
        var date = new Date(array[0], parseInt(array[1], 10) - 1, array[2]);
        if (!((date.getFullYear() == parseInt(array[0], 10))
           && ((date.getMonth() + 1) == parseInt(array[1], 10))
           && (date.getDate() == parseInt(array[2], 10)))) {
            // 不是有效的日期 
            return false;
        }
        return true;
    }

    // 日期格式错误 
    return false;
} 


function showwait() {
    try {
        showCover();
        document.getElementById('doing').className = "tddisp";
        if (doing.className == "") {
            doing.className = "tddisp";
        }
        else {

            doing.className = "";
        }
    }
    catch (e)
    { }
        

}






function printpage() {
    document.getElementById("printshow2").style.visibility = "hidden"
    document.getElementById("printshow1").style.visibility = "hidden"
    document.getElementById("printshow4").style.visibility = "hidden"
    document.getElementById("tableprint").border = "1"
    document.getElementById("printshow1").style.position = "absolute"
    document.getElementById("tableprint").cellSpacing = "0";
    document.getElementById("tableprint").cellPadding = "0";
    print();
    document.getElementById("printshow1").style.visibility = "visible"
    document.getElementById("printshow2").style.visibility = "visible"
    document.getElementById("printshow4").style.visibility = "visible"
    document.getElementById("tableprint").border = "0"
    document.getElementById("printshow1").style.position = "relative"
    
    document.getElementById("tableprint").cellSpacing = "1";
    document.getElementById("tableprint").cellPadding = "4";
}

function printaa() {
    document.getElementById("printshow2").style.visibility = "hidden"
    //document.getElementById("printshow1") .style.visibility="hidden"
    document.getElementById("printshow3").style.visibility = "hidden"
    document.getElementById("tableprint").border = "1"
    print();
    //document.getElementById("printshow1") .style.visibility="visible"
    document.getElementById("printshow2").style.visibility = "visible"
    document.getElementById("printshow3").style.visibility = "visible"
    document.getElementById("tableprint").border = "0"
}

function printbb() {
    document.getElementById("printshow1").style.visibility = "hidden"
    //document.getElementById("printshow1") .style.visibility="hidden"
    document.getElementById("printshow3").style.visibility = "hidden"
//    document.getElementById("tableprint").border = "1"
    print();
    //document.getElementById("printshow1") .style.visibility="visible"
    document.getElementById("printshow1").style.visibility = "visible"
    document.getElementById("printshow3").style.visibility = "visible"
//    document.getElementById("tableprint").border = "0"
}

function changecolor(obj, color) {
    e = event.srcElement
    if (e.checked == true) {
        e = e.parentElement
        e.style.background = "#C0C0FF"
    }
    else {
        e = e.parentElement
        e.style.background = color
    }



}





function checkAll() {
    for (var i = 0; i < document.form1.elements.length; i++) {

        document.form1.elements[i].checked = true;
    }
}

function fanAll() {
    for (var i = 0; i < document.form1.elements.length; i++) {
        if (document.form1.elements[i].checked == true)
            document.form1.elements[i].checked = false;
        else
            document.form1.elements[i].checked = true;
    }
}




function delcheck() {
    var a = 0
    for (var i = 0; i < document.form1.elements.length; i++) {
        if (document.form1.elements[i].checked == true)
        { a = a + 1 }

    }

    if (a > 0) {

    }
    else {
        alert('请至少选中一项，如果你想选择一项或者多项，请点击每行数据前的选择框即可');
        return false;
    }

    if (window.confirm("你确认删除选中项？")) {
        showwait()

        return true;
    }
    else {
        return false;
    }

}

function Movecheck() {
    if (document.getElementById('Realname').value == '') {
        alert('用户不能为空');

        return false;
    }


    var a = 0
    for (var i = 0; i < document.form1.elements.length; i++) {
        if (document.form1.elements[i].checked == true)
        { a = a + 1 }

    }

    if (a > 0) {

    }
    else {
        alert('请至少选中一项，如果你想选择一项或者多项，请点击每行数据前的选择框即可');
        return false;
    }

    if (window.confirm("你确认转移选中项到给用户[" + document.getElementById('Realname').value + "]吗？")) {
        showwait()

        return true;
    }
    else {
        return false;
    }

}




function FolderMovecheck() {

    var a = 0
    for (var i = 0; i < document.form1.elements.length; i++) {
        if (document.form1.elements[i].checked == true)
        { a = a + 1 }

    }

    if (a > 0) {

    }
    else {
        alert('请至少选中一项，如果你想选择一项或者多项，请点击每行数据前的选择框即可');
        return false;
    }

    if (window.confirm("确认转移选中项吗？")) {
        showwait()

        return true;
    }
    else {
        return false;
    }

}





function gxcheck() {
    var a = 0
    for (var i = 0; i < document.form1.elements.length; i++) {
        if (document.form1.elements[i].checked == true)
        { a = a + 1 }

    }

    if (a > 0) {

    }
    else {
        alert('请至少选中一项，如果你想选择一项或者多项，请点击每行数据前的选择框即可');
        return false;
    }

    if (window.confirm("你确认共享选中项？")) {
        showwait()

        return true;
    }
    else {
        return false;
    }

}


function qxgxcheck() {
    var a = 0
    for (var i = 0; i < document.form1.elements.length; i++) {
        if (document.form1.elements[i].checked == true)
        { a = a + 1 }

    }

    if (a > 0) {

    }
    else {
        alert('请至少选中一项，如果你想选择一项或者多项，请点击每行数据前的选择框即可');
        return false;
    }

    if (window.confirm("你确认取消共享选中项？")) {
        showwait()

        return true;
    }
    else {
        return false;
    }

}



















function updatecheck() {
    var a = 0
    for (var i = 0; i < document.form1.elements.length; i++) {
        if (document.form1.elements[i].checked == true)
        { a = a + 1 }

    }

    if (a > 0) {
        if (a > 1) {
            alert('此项操作只能选择一项')
            return false;
        }
        else {
            showwait()

        }
    }
    else {
        alert('请选中一项，如果你想选择一项，请点击每行数据前的选择框即可');
        return false;
    }

}




function closeAlert(alertid) {
    try {
        document.getElementById(alertid).outerHTML = '';
        closeCover();
    }
    catch (e) { }
}
function closeCover() {
    if (document.getElementById('AlexCoverV1_0')) {
        document.getElementById('AlexCoverV1_0').style.display = 'none';
        DispalySelect(1);
    }
}
function showCover() {
    //遮罩宽
    var sw = document.body.scrollWidth;
    //遮罩高
    var sh = document.body.scrollHeight;
    if (document.getElementById('AlexCoverV1_0')) {
        DispalySelect(0);
        document.getElementById('AlexCoverV1_0').style.display = 'block';
    }
    else {
        DispalySelect(0);
        var div = document.createElement("div");
        div.id = "AlexCoverV1_0";
        div.style.position = "absolute";
        div.style.top = "0px";
        div.style.left = "0px";
        div.style.height = sh + "px";
        div.style.width = sw + "px";
        div.style.background = "#ffffff";
        div.style.filter = "alpha(opacity=20)";
        document.body.appendChild(div);
    }
}

//显示和隐藏select控件
function DispalySelect(val) {
    var dispalyType;
    var arrdispalyType = ["hidden", "visible"];
    var arrObjSelect = document.getElementsByTagName("select");
    for (i = 0; i < arrObjSelect.length; i++) {
        arrObjSelect[i].style.visibility = arrdispalyType[val];
    }
}







